package com.concurrent.chapter3.concurrent05;

import java.util.concurrent.Phaser;

public class ThreadC extends Thread {
	private Phaser phaser;
	public ThreadC(Phaser phaser) {
		super();
		this.phaser = phaser;
	}
	
	@Override
	public void run() {
		try {
			System.out.println(Thread.currentThread().getName() + " A1 begin " + System.currentTimeMillis());
			Thread.sleep(3000);
			phaser.awaitAdvance(0);//跨栏的栏数。不参与parties计数的操作，仅具有判断功能。
			System.out.println(Thread.currentThread().getName() + " A1 end " + System.currentTimeMillis());
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}
